1. How to train an object classifier using our own images

1. Info:

I uploaded two python scripts (retrain.py, predict.py) to our scorpion server.


2. Prepare training and testing data:


3. Train a classifier

ssh to scorpion and cd to the folder:

> ssh chuah@scorpion
> cd /home/chuah/xincoder/retrain_object_classifier
> mkdir models

Assume that both "training_images" and "testing_images" are in this folder:

> ls
models/ predict.py retrain.py testing_images/ training_images/

Then, we can type the following command to starting training process:

> python retrain.py \
--bottleneck_dir=./bottlenecks \
--how_many_training_steps=50000 \
--model_dir=./inception \
--output_graph=./models/retrained_graph.pb \
--output_labels=./models/retrained_labels.txt \
--summaries_dir=./retrain_logs \
--validation_batch_size=5000 \
--image_dir=training_images # this is the folder of training data

After this training process finished, it saves the trained model in "./models".

> ls models
retrained_graph.pb retrained_labels.txt

4. Predict new images using trained model

Type the following command in a terminal to run the testing code:

> python predict.py \
--models_folder='./models' \
--test_image_folder='./testing_images' \
--display_image=False

Next: 2. Use trained model in Android, Up: Index